package top.jigw.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import top.jigw.domain.User;
import top.jigw.service.UserService;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;
    @RequestMapping("/findAll.action")
    /*public ModelAndView findAll(ModelAndView mv){
        List<User> userList = userService.findAll();
        mv.addObject("userList",userList);
        mv.setViewName("list");
        return mv;
    }*/
    public String findAll(Model model){
        List<User> userList = userService.findAll();
        model.addAttribute("userList",userList);
        return "list";
    }
}
